<?php  
/**
* 
*/
class Permission_Model extends CI_Model
{
	
	function __construct()
	{
		# code...
		parent::__construct();
	}

	public function getAllPermission(){
		return $this->db->select(' per_id,per_name,per_description ')->get('permission')->result_array();
	}

	public function getLastPermissionID(){
		$rs = $this->db->query('SELECT TOP 1 per_id FROM Permission WHERE per_id != "P99" ORDER BY per_id DESC ')->row_array();
		return $rs['per_id'];
	}

	public function insert($newPer){
		$this->db->insert('Permission',$newPer);
	}

	public function getPermissionWithID	($id){
		return $this->db->get_where('Permission',array('per_id'=>$id))->row_array();
	}

}
?>